#!/usr/bin/python
import cv
import sys
import urllib2

if __name__ == "__main__":
    cv.NamedWindow("win")

    im = cv.LoadImage('left01.jpg', cv.CV_LOAD_IMAGE_GRAYSCALE)
    im3 = cv.LoadImage('left01.jpg', cv.CV_LOAD_IMAGE_COLOR)


    chessboard_dim = ( 9, 6 )
    
    found_all, corners = cv.FindChessboardCorners( im, chessboard_dim )
    print found_all, len(corners)

    cv.DrawChessboardCorners( im3, chessboard_dim, corners, found_all )
    
    cv.ShowImage("win", im3);
    cv.WaitKey()
